import { ProgressBase } from "./ProgressBase";
import { ObjCreate } from "../common/ObjCreate";
import { ImagesConst } from "../../resource/ImagesConst";
type int = number;
//class LongProgressBar
    
    export  class LongProgressBar extends ProgressBase
    {
        constructor()
        {
            super();
            setSize(200, 14);
            return;
        }

        protected /* override */ createChildren(): void
        {
            super.createChildren();
            _barBg.setSize(200, 14);
            this.resetLabel();
            return;
        }

        protected resetLabel(): void
        {
            _label.x = (_barBg.width - _label.width) / 2;
            _label.y = -1;
            return;
        }

        public setBgSize(arg1: int, arg2: int): void
        {
            _barBg.setSize(arg1, arg2);
            this.resetLabel();
            return;
        }

        public setLabelVisible(arg1: Boolean): void
        {
            _label.visible = arg1;
            return;
        }

        public isHaveProgressPoint(arg1: Boolean): void
        {
            if (arg1) 
            {
                this._pointBitMap = ObjCreate.createBitmap(ImagesConst.Pulse_Point, 3, -2, this);
            }
            return;
        }

        public /* override */ setValue(arg1: number, arg2: number): void
        {
            super.setValue(arg1, arg2);
            if (this._pointBitMap) 
            {
                this._pointBitMap.x = _progressBar.width + 3;
            }
            return;
        }

        public setPercentValue(arg1: number, arg2: number): void
        {
            _value = arg1;
            _totalValue = arg2;
            if (arg1 > arg2) 
            {
                arg1 = arg2;
            }
            _progressBar.width = int(arg1 / arg2 * (_barBg.width - 14));
            _label.text = Math.floor(arg1 / arg2 * 100) + "%";
            _label.width = _label.textField.textWidth + 10;
            _label.x = (_barBg.width - _label.width) / 2;
            this.toolTipData = arg1 + "/" + arg2;
            return;
        }

        protected /* var */_pointBitMap: Object /* flash.display.Bitmap */;
    }
